<template>
	<section>
		<!--工具条-->
		<el-row class="toolbar" style="padding-bottom: 0px;" type="flex" >
			<el-col :span="6">
				<el-button type="primary" @click="roomassgin">考场分配</el-button>
			</el-col>
			<el-col :span="18"  style="float:right">
				<el-form :inline="true" :model="selections" style="float:right">
					<el-form-item >
						<el-input v-model="selections.studentname" style="width:140px;" placeholder="请输入学生姓名">
						</el-input>
					</el-form-item>
					<el-form-item >
						<el-select v-model="selections.province" style="width:140px;" placeholder="选择生源省份">
							<el-option v-for="province in provinceList"
									:key="province.province"
									:value="province.province"
									:label="province.province">
              </el-option>
						</el-select>
					</el-form-item>
					<el-form-item>
						<el-button type="primary" v-on:click="getUsers">查询</el-button>
					</el-form-item>
				</el-form>
			</el-col>
		</el-row>
		
		<!--列表-->
		<el-table  :data="users" highlight-current-row v-loading="listLoading" @selection-change="selsChange" border 
		:header-cell-style="{background:'#204BD6',color:'#fff'}"
		style="width: 100%;">
			<el-table-column prop="admissionTicketCode" label="准考证号" width="250" header-align='center' align='center' sortable>
			</el-table-column>
			<el-table-column prop="examineeName" label="姓名" header-align='center' width="150" sortable>
			</el-table-column>
			<el-table-column prop="identificationNumber" label="身份证号" width="250" header-align='center' sortable>
			</el-table-column>
			<el-table-column prop="studioName" label="所属画室" header-align='center' sortable>
			</el-table-column>
			<el-table-column prop="province" label="所属省份" width="120" header-align='center' align='center' sortable>
			</el-table-column>
			<el-table-column prop="examinationRoomCode" label="考场" width="150" header-align='center' align='center' sortable>
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="20" :total="total" style="float:right;">
			</el-pagination>
		</el-col>

		<!--编辑界面-->
		<el-dialog title="考场分配" :visible.sync="roomAssginVisible" :close-on-click-modal="false" style="font-size: 30px;" >
			<examRoomAssgin></examRoomAssgin>
		</el-dialog>

		
	</section>
</template>

<script>
	import provinceCodeList from "../../utils/provinceCode";
	import { editUser, addUser,examinee_listExamineeInfo } from '../../api/api';

	import examRoomAssgin from './examRoomAssgin'
	export default {
		components:{examRoomAssgin},
		data() {
			return {
				provinceList: provinceCodeList,
				users: [],
				total: 0,
				page: 1,
				listLoading: false,
				sels: [],//列表选中列
				selections:{
					size:10,
					current:1,
					provinces:'',//选择省份
					studentname:'',//选择省份
				},
				roomAssginVisible: false,//编辑界面是否显示
				editLoading: false,

			}
		},
		methods: {
			roomassgin(){
				this.roomAssginVisible = true;
			},
			handleCurrentChange(val) {
				this.page = val;
				this.getUsers();
			},
			getUsers() {
				this.listLoading = true;
				examinee_listExamineeInfo(this.selections).then((res) => {
					this.total = res.result.total;
					this.users = res.result.records;
					this.listLoading = false;
				});
			},
		

			selsChange: function (sels) {
				this.sels = sels;
			},
		},
		mounted() {
			this.getUsers();
		}
	
}
</script>

<style>
.el-button--small{
	padding: 1px 1px;
}
.el-dialog__header{
	text-align: center;
}
.el-dialog__title{
	font-size: 32px;
}
</style>